package cn.com.gainfo.recks.business.systemSet;

import java.util.List;

import javax.sql.DataSource;

import cn.com.gainfo.recks.dao.systemSet.LogDAO;
import cn.yzyue.base.business.AbstractBusiness;
import cn.yzyue.base.tools.db.SQL;
import cn.yzyue.base.vo.VO;

public class LogBusiness extends AbstractBusiness{

	private LogDAO  dao =null;
	
	public LogBusiness() {
		dao=new LogDAO();
	}
	
	@Override
	public boolean add(DataSource dataSource, VO vo) {
		// TODO Auto-generated method stub
		return dao.add(dataSource, vo);
	}


	@Override
	public List find(DataSource dataSource, SQL sql, int page) {
		return dao.find(dataSource, sql, page);
	}

	public String getLogSql(String sqlCondition){
		String sql=" select  id , logdate ,  username , context  from  log  ";
		if(sqlCondition != null && !sqlCondition.trim().equals("")){
			sql += "where " + sqlCondition;
		}
		sql += "order by  logdate  desc";
		return sql;
	}
	
	
	public String getLogCountSql(String sqlCondition){
		String sql="select count(id) from  log  ";
		if(sqlCondition != null && !sqlCondition.trim().equals("")){
			sql += "where " + sqlCondition;
		}
		return sql;	
		}
	
	
	
	
	
	
	
	
}
